import { createContext,useState,useContext } from "react";

const AuthContext = createContext();
export const useAuth = () => {
    return useContext(AuthContext);
}

const AuthProvider = (props) => {
    const [isLogin,setIsLogin] = useState(localStorage.getItem('isLogin') || false);

    return <AuthContext.Provider value={{isLogin,setIsLogin}}>
        {props.children}
    </AuthContext.Provider>
}

export default AuthProvider;